package com.example.myapp;

import android.content.Context;
import android.graphics.drawable.BitmapDrawable;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;

/**
 * Created by 艳双 on 2015/12/17.
 * project:TakePhoto
 * user:lisa[FR]
 * Date:2015/12/17
 */
public class PhotoPopuwindow extends PopupWindow {
    public  PhotoPopuwindow(final Context mContext,View parent,final
            DopostCallback callBack){
        View view= View.inflate(mContext,R.layout.photopopuwindow,null);
//        view.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.fade_in));
        LinearLayout ll_popu= (LinearLayout) view.findViewById(R.id.ll_popu);
//        ll_popu.startAnimation(AnimationUtils.loadAnimation(mContext, R.anim.push_bottom_in));
        setWidth(WindowManager.LayoutParams.MATCH_PARENT);
        setHeight(WindowManager.LayoutParams.MATCH_PARENT);
        setBackgroundDrawable(new BitmapDrawable());
        setFocusable(true);
        setOutsideTouchable(true);
        setContentView(view);
        showAtLocation(view, Gravity.BOTTOM, 0, 0);
        TextView textView1= (TextView) view.findViewById(R.id.popu_takephoto);
        textView1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                callBack.callback("1");
            }
        });
        TextView textView2= (TextView) view.findViewById(R.id.popu_album);
        textView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                callBack.callback("2");
            }
        });
        TextView textView3= (TextView) view.findViewById(R.id.popu_cancel);
        textView3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

    }
}
